home *** CD-ROM | disk | FTP | other *** search
- # AMake
- #
- # Synopsis:
- # AMake [ <maketarget> ]
- # [ --arch 68K | PPC | Fat ]
- # [ --build Debug | Release | all ]
- #
- # Options:
- # --arch # Specify which architecture to build for. No PPC support yet.
- # --build # Specify which build type.
-
- # Start the timer
- Set TIME0 `date -n`
-
- # Set some variables
- Execute "ALDirMacros"
- set PROFILE ":{MANIFEST}:Profile.mpwsh"
-
- # Defaults
- Set PREMAKEFILE "{SCRIPTS}Premake.mk"
- Set DEPMAKEFILE "{SCRIPTS}DepMake.mk"
- Set MAKEFILE "{SCRIPTS}Master.mk"
- Set MAKETARGET default
-
- # Parse the command line.
- Loop
- Break If {#} == 0
- If "{1}" == "--arch"
- Set ARCH "{2}"
- Shift; Shift
- Else If "{1}" == "--build"
- If "{2}" == "Debug" || "{2}" == "Release" || "{2}" == "all" || "{2}" == "--default"
- Set BUILD "{2}"
- End
- Shift; Shift
- Else If "{1}" == "--target"
- Set MAKETARGET "{2}"
- Shift; Shift
- Else
- #Echo "{0}: Error: Unknown thing '{1}' on the command line."
- #Exit 1
- Set MAKETARGET "{1}"
- Shift
- End
- End
-
- If !"{ARCH}" || "{ARCH}" == "--default"
- Set ARCH 68K # Change this to use current arch
- If `Gestalt 'cput'` >= 256
- Set ARCH PPC
- End If
- End
- Set COMPILER MW
- If !"{BUILD}" || "{BUILD}" == "--default"
- Set BUILD Debug
- End
-
- Set ACTION "make"
-
- # Check to make sure that either a project was specified or that we're already in one.
- If !`Exists ":Manifest:"`
- Echo "{0}: There must be a project selected."
- Exit 1
- End
-
- Begin
-
- If `Exists -f "{PROFILE}"`
- Execute "{PROFILE}"
- End
-
- Set -e PROJNAME "{NAME}"
-
- # Mainly something to click on and hit Enter to rebuild
- Echo "Making {NAME}"
- Begin
- Set SAVEEXIT {Exit}
- Set Exit 0
- Echo `echo "Making {NAME}" | sed "s/./-/g"`
- Set Exit {SAVEEXIT}
- End ≥ Dev:Null
- Echo ""
- Echo -n "({0}"
- If "{ARCH}"
- Echo -n " --arch {ARCH}"
- End
- If "{BUILD}"
- Echo -n " --build {BUILD}"
- End
- Echo ")"
- Echo ""
-
- set TIME1 `date -n`
- set TIME2 {TIME1}
-
- set MAKE "dmake -n"
- set CMDS "Dev:stdout"
- set LABEL "# Select the following commands and hit Enter to make {NAME}."
- set PART2 "Building dependent targets"
- set PART4 "Running 'dmake -n'"
- set PART5 "Actually building {NAME}"
-
- set TIME3 `date -n`
-
- Set LABDIR `FindLabFolder`
- Set PROJLABDIR "{LABDIR}{NAME}:"
- If !`Exists "{PROJLABDIR}"`
- NewFolder "{PROJLABDIR}"
- End
-
- Set -e RULESDIR "{PROJLABDIR}{RULES}:"
- If !`Exists "{RULESDIR}"`
- NewFolder "{RULESDIR}"
- End
-
- Echo "Pre-making..."
-
- Premake.pl
- #RunMake PROJLABDIR="{PROJLABDIR}" -f "{PREMAKEFILE}" premake
- SetFile -c 'R*ch' "{RULESDIR}Sources.mk" "{RULESDIR}Imports.mk"
-
- set TIME4 `date -n`
-
- Echo "Making dependencies..."
- If 0 # `Exists -d "[Dependencies]"`
- If !`Exists -f "{RULESDIR}Dependencies.mk"`
- Set HEADER "# Make dependencies generated automatically by AMake."
- Echo "{HEADER}" > "{RULESDIR}Dependencies.mk"
- Echo "" >> "{RULESDIR}Dependencies.mk"
- Catenate `Files -f ":{DEPS}:"` >> "{RULESDIR}Dependencies.mk"
- SetFile -c 'R*ch' "{RULESDIR}Dependencies.mk"
- End If
- RunMake -f "{DEPMAKEFILE}" depmake
- Else
- MakeDeps
- End If
-
- Catenate ":Manifest:Demographics.mk" "{RULESDIR}Sources.mk" "{RULESDIR}Imports.mk" "{RULESDIR}Dependencies.mk" > "Include.mk"
- SetFile -c 'R*ch' "Include.mk"
-
- Echo "Making..."
- RunMake BUILD="{BUILD}" ARCH="{ARCH}" PROJLABDIR="{PROJLABDIR}" -f "{MAKEFILE}" "{MAKETARGET}"
-
- Delete -y "Include.mk"
-
- Echo "Okay, enough of that."
-
- set TIME5 `date -n`
-
- #playsound "Indigo"
-
- echo ""
-
- set DELTA `evaluate {TIME5} - {TIME0}`
- if {DELTA} == 1
- set TIME "1 second"
- else if {DELTA} <= 60
- set TIME "{DELTA} seconds"
- else
- set MIN `evaluate {DELTA} div 60`
- set SEC `evaluate {DELTA} % 60`
- if `evaluate {SEC} div 10` == 0
- set PADSEC 0
- end
- set MIN `evaluate {DELTA} div 60`
- set TIME "{MIN}:{PADSEC}{SEC}"
- end
- echo "# Total build time: {TIME}"
-
- set DELTA1 `evaluate {TIME1} - {TIME0}`
- if {DELTA1} == 1
- set SECONDS1 second
- else
- set SECONDS1 seconds
- end
- echo "# Initial overhead took {DELTA1} {SECONDS1}."
-
- if "{ACTION}" == "make" and "{PREBUILD}" != ""
- set DELTA2 `evaluate {TIME2} - {TIME1}`
- if {DELTA2} == 1
- set SECONDS2 second
- else
- set SECONDS2 seconds
- end
- #echo "# {PART2} took {DELTA2} {SECONDS2}."
- end
-
- set DELTA3 `evaluate {TIME3} - {TIME2}`
- if {DELTA3} == 1
- set SECONDS3 second
- else
- set SECONDS3 seconds
- end
- # echo "# Constructing the arguments to dmake took {DELTA3} {SECONDS3}."
-
- set DELTA `evaluate {TIME4} - {TIME3}`
- if {DELTA} == 1
- set TIME "1 second"
- else
- set TIME "{DELTA} seconds"
- end
- echo "# {PART4} took {TIME}."
-
- if "{ACTION}" == "make"
- set DELTA `evaluate {TIME5} - {TIME4}`
- if {DELTA} == 1
- set TIME "1 second"
- else if {DELTA} <= 60
- set TIME "{DELTA} seconds"
- else
- set MIN `evaluate {DELTA} div 60`
- set SEC `evaluate {DELTA} % 60`
- set PADSEC ""
- if `evaluate {SEC} div 10` == 0
- set PADSEC 0
- end
- set MIN `evaluate {DELTA} div 60`
- set TIME "{MIN}:{PADSEC}{SEC}"
- End
- Echo "# {PART5} took {TIME}."
- End
- Echo ""
-
- End
-
-
- Exit
- # The end.
-